package red.book._1._1;

/**
 * 计算调和函数的总值
 * @author wangbingwu
 *
 */
public class CalculateSumOfHarmonicSeries {
	public static void main(String[] args) {
		int target = 10;
		
		System.out.println(harmonic(target));
	}
	
	public static double harmonic(int target) {
		double sum = 0.0;
		for(int i = 1; i <= target; i++) {
			sum += 1.0 / i;
		}
		
		return sum;
	}
}
